package yunjiao.designpatterns.interpreter;

import lombok.extern.slf4j.Slf4j;

/**
 * 入口
 *
 * @author yangyunjiao
 */
@Slf4j
public class App {
    public static void main(String[] args) {
        TerminalExpression.StringExpression stringExpression = new TerminalExpression.StringExpression("a");
        TerminalExpression.IntExpression intExpression = new TerminalExpression.IntExpression(1);
        Context context = new Context("123");

        log.info("And result: {}", context.getResult(new NonTerminalExpression.AndExpression(stringExpression, intExpression)));
        log.info("Or result: {}", context.getResult(new NonTerminalExpression.OrExpression(stringExpression, intExpression)));
    }
}
